<?php echo getButtonsHTML($item['id'], $buttons_params); ?>
<br clear="both" />
<input type="hidden" name="action" value="editor" />
<input type="hidden" name="item" value="<?php echo $item['id']; ?>" />
<fieldset>
	<dl>
		<dt>Name:</dt>
		<dd>
			<input name="name" type="text" value="<?php echo $item['name']; ?>" style="width:30%">
			&nbsp;<?php echo $NameStatus; ?>
			<input type="submit" value="Save" style="padding-left:20px; padding-right:10px;  background-image: url('../images/system/save.gif'); border:1px solid #DDDDDD; height:20px;" class="buttons">
		</dd>
	</dl>
	<dl>
		<dt>Button - Type</dt>
		<dd>
			<select name="type">
				<option value="0" <?php if($item['type'] == 0) { echo 'selected="selected"'; }?>>Link</option>
				<option value="1" <?php if($item['type'] == 1) { echo 'selected="selected"'; }?>>jQuery - Button</option>
				<option value="2" <?php if($item['type'] == 2) { echo 'selected="selected"'; }?>>Button - Button</option>
			</select>
		</dd>
	</dl>
	<dl>
		<dt>Height:</dt>
		<dd>
			<select name="height">
				<?php 
					$i=1;
					while($i <= 200)
					{
						if ($i == $item['height'])
						{
							echo '<option value="'.$i.'" selected>'.$i.' px</option>';
						}
						else
						{
							echo '<option value="'.$i.'">'.$i.' px</option>';
						}
						$i ++;
					}
				?>
			</select>
		</dd>
	</dl>
	<?php if($item['type'] == 0):  ?>
	<dl>
		<dt>Left Image: <?php echo $item['l_image']; ?></dt>
		<dd>
			<input id="l_image" name="l_image" type="file" ></input>
			<?php 
				if($item['l_image'] != "")
				{
					$size = getimagesize(BUTTONS_PATH.$item['l_image']); 
					$fp = fopen(BUTTONS_PATH.$item['l_image'], "rb");
					if ($size && $fp) 
					{
						echo $size[0]." x ";
						echo $size[1]." px ";
					}
				}
				echo $error['l_image'];
			?>
			<?php if($item['l_image'] != "") { ?>
				<input type="checkbox" name="delete_l" value="1"><strong>(Delete Left)</strong>
			<?php } ?>
		</dd>
	</dl>
	<dl>
		<dt>Left Image hover: <?php echo $item['l_image_h']; ?></dt>
		<dd>
			<input id="l_image_h" name="l_image_h" type="file" ></input>
			<?php 
				if($item['l_image_h'] != "")
				{
					$size = getimagesize(BUTTONS_PATH.$item['l_image_h']); 
					$fp = fopen(BUTTONS_PATH.$item['l_image_h'], "rb");
					if ($size && $fp) 
					{
						echo $size[0]." x ";
						echo $size[1]." px ";
					}
				}
				echo $error['l_image_h'];
			?>
			<?php if($item['l_image_h'] != "") { ?>
				<input type="checkbox" name="delete_l_h" value="1"><strong>(Delete Left Hover)</strong>
			<?php } ?>
		</dd>
	</dl>
	<dl>
		<dt>Background Image: <?php echo $item['image']; ?></dt>
		<dd>
			<input id="image" name="image" type="file" value=""></input>
			<?php 
				if($item['image'] != "")
				{
					$size = getimagesize(BUTTONS_URL.$item['image']); 
					$fp = fopen(BUTTONS_PATH.$item['image'], "rb");
					if ($size && $fp) 
					{
						echo $size[0]." x ";
						echo $size[1]." px ";
						//echo $size[2];
						//echo $size[3];
					}
				}
				echo $error['image'];
			?>
			<?php if($item['image'] != "") { ?>
					<input type="checkbox" name="delete_bg" value="1"><strong>(Delete Background)</strong>
			<?php } ?>
		</dd>
	</dl>
	<dl>
		<dt>Background Image Hover: <?php echo $item['image_h']; ?></dt>
		<dd>
			<input id="image_h" name="image_h" type="file" value=""></input>
			<?php 
				if($item['image_h'] != "")
				{
					$size = getimagesize(BUTTONS_URL.$item['image_h']); 
					$fp = fopen(BUTTONS_PATH.$item['image_h'], "rb");
					if ($size && $fp) 
					{
						echo $size[0]." x ";
						echo $size[1]." px ";
					}
				}
				echo $error['image_h'];
			?>
			<?php if($item['image_h'] != "") { ?>
					<input type="checkbox" name="delete_bg_h" value="1"><strong>(Delete Background Hover)</strong>
			<?php } ?>
		</dd>
	</dl>
	<dl>
		<dt>Right Image: <?php echo $item['r_image']; ?></dt>
		<dd>
			<input id="r_image" name="r_image" type="file" value=""></input>
			<?php 
				if($item['r_image'] != "")
				{
					$size = getimagesize(BUTTONS_PATH.$item['r_image']); 
					$fp = fopen(BUTTONS_PATH.$item['r_image'], "rb");
					if ($size && $fp) 
					{
						echo $size[0]." x ";
						echo $size[1]." px ";
					}
				} 
				echo $error['r_image'];
			?>
			<?php if($item['r_image'] != "") { ?>
				<input type="checkbox" name="delete_r" value="1"><strong>(Delete Right)</strong>
			<?php } ?>
		</dd>
	</dl>
	<dl>
		<dt>Right Image Hover: <?php echo $item['r_image_h']; ?></dt>
		<dd>
			<input id="r_image_h" name="r_image_h" type="file" value=""></input>
			<?php 
				if($item['r_image_h'] != "")
				{
					$size = getimagesize(BUTTONS_PATH.$item['r_image_h']); 
					$fp = fopen(BUTTONS_PATH.$item['r_image_h'], "rb");
					if ($size && $fp) 
					{
						echo $size[0]." x ";
						echo $size[1]." px ";
					}
				} 
				echo $error['r_image_h'];
			?>
			<?php if($item['r_image_h'] != "") { ?>
				<input type="checkbox" name="delete_r_h" value="1"><strong>(Delete Right Hover)</strong>
			<?php } ?>
		</dd>
	</dl>
	<?php endif; ?>
	<dl>
		<dt>Edit Button Style</dt>
		<dd>&nbsp;</dd>
	</dl>
	<table cellpadding="0" cellspacing="0" border="1" style="cursor:pointer; width:100%; background-color:#EEEEEE; height:30px;">
		<tr>
			<td id="board_1" colspan="3" onclick="setVisible('cb_div'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Button Set Container</td>
		</tr>
		<?php if($item['type'] == 0):  ?>
		<tr>
			<td id="board_2" onclick="setVisible('cb_a'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Left Bg And Button Margin</td>
			<td id="board_3" onclick="setVisible('cb_span'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Text Container</td>
			<td id="board_4" onclick="setVisible('cb_span_right'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Right Bg</td>
		</tr>
		<tr>
			<td id="board_5" onclick="setVisible('cb_a_h'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Left Bg "Hover"</td>
			<td id="board_6" onclick="setVisible('cb_span_h'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Mid Bg And Text "Hover"</td>
			<td id="board_7" onclick="setVisible('cb_span_right_h'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Right Bg "Hover"</td>
		</tr>
		<tr>
			<td id="board_8" onclick="setVisible('cb_a_active'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Left Bg "Active"</td>
			<td id="board_9" onclick="setVisible('cb_span_active'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Mid Bg And Text "Active"</td>
			<td id="board_10" onclick="setVisible('cb_span_right_active'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Right Bg "Active"</td>
		</tr>
		<?php endif; ?>
        <?php if($item['type'] == 1):  ?>
		<tr>
			<td id="board_2" onclick="setVisible('ui-button'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Button Style</td>
		</tr>
		<tr>
			<td id="board_3" onclick="setVisible('ui-button-text'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Text Container</td>
		</tr>
		<?php endif; ?>
		<?php if($item['type'] == 2):  ?>
		<tr>
			<td id="board_2" onclick="setVisible('cb_button'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Button Style</td>
		</tr>
		<tr>
			<td id="board_3" onclick="setVisible('cb_button_txt'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Text Container</td>
		</tr>
		<tr>
			<td id="board_4" onclick="setVisible('cb_button_hover'); toggleClassName(this.id, 'board_active');" align="center" style="width:60px; border-right:1px solid #CCCCCC;">Button Hover</td>
		</tr>
		<?php endif; ?>
	</table>
	<?php $style['cb_div'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id']); ?>
	<dl id="cb_div" style="display:none;">
		<dt>div.cb_<?php echo $item['id']; ?></dt>
		<dd>
			<textarea name="cb_div" style="width:50%; height:120px;"><?php echo $style['cb_div']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['cb_a'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' ul li.com_button a');
	if($style['cb_a'] == '')
	{ 
		if($item['l_image'] != '')
		{ $style['cb_a'] = 'padding-left:'.$size_l[0].'px; background:transparent url(images/'.$item['l_image'].') no-repeat scroll left top;'; }
	}
	?>
	<dl id="cb_a" style="display:none;">
		<dt>div.com_buttons div.cb_<?php echo $item['id']; ?> ul li.com_button a</dt>
		<dd>
			<textarea name="cb_a" style="width:50%; height:120px;"><?php echo $style['cb_a']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['ui-button'] = getStyleCss(3, $item['id'], '.cb_'.$item['id'].' .ui-button');
	?>
	<dl id="ui-button" style="display:none;">
		<dt>.cb_<?php echo $item['id']; ?> ui-button</dt>
		<dd>
			<textarea name="ui-button" style="width:50%; height:120px;"><?php echo $style['ui-button']; ?></textarea>
		</dd>
	</dl>
    <?php 
	$style['ui-button-text'] = getStyleCss(3, $item['id'], '.cb_'.$item['id'].' .ui-button-text');
	?>
	<dl id="ui-button-text" style="display:none;">
		<dt>.cb_<?php echo $item['id']; ?> .ui-button-text</dt>
		<dd>
			<textarea name="ui-button-text" style="width:50%; height:120px;"><?php echo $style['ui-button-text']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['cb_button'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' button');
	?>
	<dl id="cb_button" style="display:none;">
		<dt>div.com_buttons div.cb_<?php echo $item['id']; ?> button</dt>
		<dd>
			<textarea name="cb_button" style="width:50%; height:120px;"><?php echo $style['cb_button']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['cb_button_hover'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' button:hover, div.com_buttons div.cb_'.$item['id'].' button.active');
	?>
	<dl id="cb_button_hover" style="display:none;">
		<dt>div.com_buttons div.cb_<?php echo $item['id']; ?> button:hover</dt>
		<dd>
			<textarea name="cb_button_hover" style="width:50%; height:120px;"><?php echo $style['cb_button_hover']; ?></textarea>
		</dd>
	</dl>
	
    <?php 
	$style['cb_button_txt'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' button span');
	?>
	<dl id="cb_button_txt" style="display:none;">
		<dt>div.com_buttons div.cb_<?php echo $item['id']; ?> button span</dt>
		<dd>
			<textarea name="cb_button_txt" style="width:50%; height:120px;"><?php echo $style['cb_button_txt']; ?></textarea>
		</dd>
	</dl>
	
	<?php 
	$style['cb_a_h'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' ul li.com_button a:hover');
	if($style['cb_a_h'] == '')
	{ 
		if($item['l_image_h'] != '')
		{ $style['cb_a_h'] = 'background-image:url(images/'.$item['l_image_h'].');'; }
	}
	?>
	<dl id="cb_a_h" style="display:none;">
		<dt>div.com_buttons div.cb_<?php echo $item['id']; ?> ul li.com_button a:hover</dt>
		<dd>
			<textarea name="cb_a_h" style="width:50%; height:120px;"><?php echo $style['cb_a_h']; ?></textarea>
		</dd>
	</dl>
	
	<?php 
	$style['cb_a_active'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' ul li.com_button a.active');
	if($style['cb_a_active'] == '')
	{ 
		if($item['l_image_h'] != '')
		{ $style['cb_a_h'] = 'background-image:url(images/'.$item['l_image_h'].');'; }
	}
	?>
	<dl id="cb_a_active" style="display:none;">
		<dt>div.com_buttons div.cb_<?php echo $item['id']; ?> ul li.com_button a.active</dt>
		<dd>
			<textarea name="cb_a_active" style="width:50%; height:120px;"><?php echo $style['cb_a_active']; ?></textarea>
		</dd>
	</dl>
	
	<?php 
	$style['cb_span_right'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' ul li.com_button a span.right');
	if($style['cb_span_right'] == '')
	{ 
		if($item['r_image'] != '')
		{ 
			
			$style['cb_span_right'] = $style['cb_span_right'].' padding-right:'.$size_r[0].'px;  background:transparent url(images/'.$item['r_image'].') no-repeat scroll right top;'; 
		}
	}
	?>
	<dl id="cb_span_right" style="display:none;">
		<dt>div.com_buttons div.cb_<?php echo $item['id']; ?> ul li.com_button a span.right</dt>
		<dd>
			<textarea name="cb_span_right" style="width:50%; height:120px;"><?php echo $style['cb_span_right']; ?></textarea>
		</dd>
	</dl>
	
	<?php 
	$style['cb_span_right_h'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' ul li.com_button a:hover span.right');
	if($style['cb_span_right_h'] == '')
	{ 
		if($item['r_image_h'] != '')
		{ 
			$style['cb_span_right_h'] = 'background-image:url(images/'.$item['r_image_h'].');'; 
		}
	}
	?>
	<dl id="cb_span_right_h" style="display:none;">
		<dt>div.com_buttons div.cb_<?php echo $item['id']; ?> ul li.com_button a:hover span.right</dt>
		<dd>
			<textarea name="cb_span_right_h" style="width:50%; height:120px;"><?php echo $style['cb_span_right_h']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['cb_span_right_active'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' ul li.com_button a.active span.right');
	if($style['cb_span_right_active'] == '')
	{ 
		if($item['r_image_active'] != '')
		{ 
			$style['cb_span_right_active'] = 'background-image:url(images/'.$item['r_image_h'].');'; 
		}
	}
	?>
	<dl id="cb_span_right_active" style="display:none;">
		<dt>div.com_buttons div.cb_<?php echo $item['id']; ?> ul li.com_button a.active span.right</dt>
		<dd>
			<textarea name="cb_span_right_active" style="width:50%; height:120px;"><?php echo $style['cb_span_right_active']; ?></textarea>
		</dd>
	</dl>
	
	<?php 
	$style['cb_span'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' ul li.com_button a span.right span');
	if($style['cb_span'] == '')
	{ 
		if($item['image'] != '')
		{ 
			$style['cb_span'] = ' height:'.$item['height'].'px; ';
			$style['cb_span'] = $style['cb_span'].' background:transparent url(images/'.$item['image'].') repeat-x scroll left top;'; 
		}
	}
	
	$style['cb_span_span_center'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' ul li.com_button a span.right span span.center');
	if($style['cb_span_span_center'] == '')
	{ $style['cb_span_span_center'] = 'padding-top:0px;'; }
	
	?>
	<dl id="cb_span" style="display:none;">
		<dt>div.com_buttons div.cb_<?php echo $item['id']; ?> ul li.com_button a span.right span</dt>
		<dd>
			<textarea name="cb_span" style="width:50%; height:120px;"><?php echo $style['cb_span']; ?></textarea>
		</dd>
        
        <dt>div.com_buttons div.cb_<?php echo $item['id']; ?> ul li.com_button a span.right span span.center</dt>
		<dd>
			<textarea name="cb_span_span_center" style="width:50%; height:120px;"><?php echo $style['cb_span_span_center']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['cb_span_h'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' ul li.com_button a:hover span.right span');
	if($style['cb_span_h'] == '')
	{ 
		if($item['image_h'] != '')
		{ 
			$style['cb_span_h'] = 'background-image:url(images/'.$item['image_h'].');'; 
		}
	}
	?>
	<dl id="cb_span_h" style="display:none;">
		<dt>div.com_buttons div.cb_<?php echo $item['id']; ?> ul li.com_button a:hover span.right span</dt>
		<dd>
			<textarea name="cb_span_h" style="width:50%; height:120px;"><?php echo $style['cb_span_h']; ?></textarea>
		</dd>
	</dl>
	<?php 
	$style['cb_span_active'] = getStyleCss(3, $item['id'], 'div.com_buttons div.cb_'.$item['id'].' ul li.com_button a.active span.right span');
	if($style['cb_span_active'] == '')
	{ 
		if($item['image_active'] != '')
		{ 
			$style['cb_span_active'] = 'background-image:url(images/'.$item['image_h'].');'; 
		}
	}
	?>
	<dl id="cb_span_active" style="display:none;">
		<dt>div.com_buttons div.cb_<?php echo $item['id']; ?> ul li.com_button a.active span.right span</dt>
		<dd>
			<textarea name="cb_span_active" style="width:50%; height:120px;"><?php echo $style['cb_span_active']; ?></textarea>
		</dd>
	</dl>
	<dl>
		<dt>Header Categories:</dt>
		<dd>
			<select size="10" name="hfb_cats" style="width:20%;">
				<?php 
				if($hfbcats)
				{
					foreach($hfbcats as $hfbcat)
					{
						echo '<option ondblclick="edit_form.add_to_cat.value=this.value; edit_form.submit();" value="'.$hfbcat['id'].'">'.$hfbcat['title'].'</option>';
					}
				}
				?>
			</select>
			<select size="10" name="hfb_in_cats" style="width:20%;">
				<?php 
				if($incats)
				{
					foreach($incats as $incat)
					{
						echo '<option ondblclick="edit_form.rem_from_cat.value=this.value; edit_form.submit();" value="'.$incat['id'].'">'.$incat['title'].'</option>';
					}
				}
				?>
			</select>
			<input type="hidden" id="add_to_cat" name="add_to_cat" value="0" />
			<input type="hidden" id="rem_from_cat" name="rem_from_cat" value="0" />
		</dd>
	</dl>
</fieldset>